package com.hyf.websocket.controller;

import com.hyf.websocket.entity.BulletMessageVO;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Controller;

@Controller
public class BulletController {

    @MessageMapping("/chat")
    @SendTo("/toAll/bulletScreen")  //SendTo 发送至broker 下的指定订阅
    public String say(BulletMessageVO messageVO){
        String result=null;
        if(messageVO!=null){
            result=messageVO.getUsername()+":"+messageVO.getMessage();
        }
        return result;
    }

}
